
$(function(){
  

        //订单详情倒计时
        var time = parseInt($("#orderCutDown").attr("data"))
        if(time < 0){
            $("#orderCutDown").remove();
        }else{
            dateCountDown($("#orderCutDown"),time);
        }
        var width =  $(".order-detail").width();
        $(".img-list img").height(width*0.25-4);

        //取消订单
        $(document).on("click",".cancel",function(){
            var cancelUrl = $(this).attr("data-url");
            $.confirm(["温馨提示","是否确认取消订单","残忍取消","继续购买"],function(){
                $.doAjax({
                    url:cancelUrl,
                    type:"post",
                    success:function(data){
                        if(data.flag){
                            $(".staus").html("已取消");
                            $(".btn").remove();
                            $("#orderCutDown").remove();
                        }else{
                            $.alert(data.msg);
                        }
                    }
                }) 
            },"");
        });

        //确认收货
        $(document).on("click",".getGoods",function(){
            var _this = $(this);
            var getUrl = $(this).attr("data-href");
            $.confirm(["温馨提示","是否确认收货","确定","取消"],function(){
                $.doAjax({
                    url:getUrl,
                    type:"post",
                    success:function(data){
                        if(data.flag){
                            $(".staus").html("待评论");
                            _this.remove()
                            $(".shaidan").css("display","inline-block");
                        }else{
                            $.alert(data.msg);
                        }
                    }
                }) 
            },"");
        });
    
    $(document).on("click",".shaidan",function(){
        $.alert("微信端暂不支持评论，前去PC端评论可获100试豆奖励");
    });
 
})
